﻿using Common.Device.Enums;
using Common.View.Base;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.Device.ViewModels
{
    public class FuncViewModel : BindableBase
    {
        private int menuIndex = 0;
        /// <summary>
        /// 菜单索引
        /// </summary>
        public int MenuIndex
        {
            get { return menuIndex; }
            set { SetProperty(ref menuIndex, value); }
        }
        private int delayTime;
        /// <summary>
        /// 延时
        /// </summary>
        public int DelayTime
        {
            get { return delayTime; }
            set { SetProperty(ref delayTime, value); }
        }
        private string funcStr;
        /// <summary>
        /// 计算表达式
        /// </summary>
        public string FuncStr
        {
            get { return funcStr; }
            set { SetProperty(ref funcStr, value); }
        }
        private string funcMax;
        /// <summary>
        /// 计算最大值
        /// </summary>
        public string FuncMax
        {
            get { return funcMax; }
            set { SetProperty(ref funcMax, value); }
        }
        private string funcMin;
        /// <summary>
        /// 计算最小值
        /// </summary>
        public string FuncMin
        {
            get { return funcMin; }
            set { SetProperty(ref funcMin, value); }
        }
        private string funcUnit;
        /// <summary>
        /// 计算单位
        /// </summary>
        public string FuncUnit
        {
            get { return funcUnit; }
            set { SetProperty(ref funcUnit, value); }
        }
        private int testIndex = 1;
        /// <summary>
        /// 取值测试项序号
        /// </summary>
        public int TestIndex
        {
            get { return testIndex; }
            set { SetProperty(ref testIndex, value); }
        }
        private string testNum;
        /// <summary>
        /// 取值测试项内编号
        /// </summary>
        public string TestNum
        {
            get { return testNum; }
            set { SetProperty(ref testNum, value); }
        }


        private List<string> infos = Enum.GetNames(typeof(FuncEnum.FuncInfos)).ToList();
        /// <summary>
        /// 交互集合
        /// </summary>
        public List<string> Infos
        {
            get { return infos; }
            set { SetProperty(ref infos, value); }
        }
        private string infoStr = FuncEnum.FuncInfos.弹窗确认结果.ToString();
        /// <summary>
        /// 交互
        /// </summary>
        public string InfoStr
        {
            get { return infoStr; }
            set { SetProperty(ref infoStr, value); }
        }
        private string infoTitle;
        /// <summary>
        /// 交互标题
        /// </summary>
        public string InfoTitle
        {
            get { return infoTitle; }
            set { SetProperty(ref infoTitle, value); }
        }

        private List<string> loopDevices = DeviceService.useDevices.Values
            .Where(o => o.temp == DeviceEnum.DeviceTempEnum.电子负载 || o.temp == DeviceEnum.DeviceTempEnum.电源)
            .Select(o => o.name).ToList();
        /// <summary>
        /// 循环设备集合，电源，电子负载支持循环
        /// </summary>
        public List<string> LoopDevices
        {
            get { return loopDevices; }
            set { SetProperty(ref loopDevices, value); }
        }
        private string loopDevice;
        /// <summary>
        /// 循环设备
        /// </summary>
        public string LoopDevice
        {
            get { return loopDevice; }
            set { SetProperty(ref loopDevice, value); }
        }
        private string loopFunc;
        /// <summary>
        /// 循环方式 +1 ，-1 ..
        /// </summary>
        public string LoopFunc
        {
            get { return loopFunc; }
            set { SetProperty(ref loopFunc, value); }
        }
        private int loopTimes=1;
        /// <summary>
        /// 循环次数
        /// </summary>
        public int LoopTimes
        {
            get { return loopTimes; }
            set { SetProperty(ref loopTimes, value); }
        }
        private List<string> loopBreaks = new List<string>() { "测试通过" };
        /// <summary>
        /// 退出循环条件
        /// </summary>
        public List<string> LoopBreaks
        {
            get { return loopBreaks; }
            set { SetProperty(ref loopBreaks, value); }
        }
        private string loopBreak = "测试通过";
        /// <summary>
        /// 退出循环条件
        /// </summary>
        public string LoopBreak
        {
            get { return loopBreak; }
            set { SetProperty(ref loopBreak, value); }
        }
    }
}
